﻿<System.ComponentModel.DefaultEvent("PanelSaved")>
Public Class PanelProperties
    Public Class PanelSaveEventArgs
        Inherits System.EventArgs

        Dim Size As Integer

        Public ReadOnly Property Height
            Get
                Return Size
            End Get
        End Property

        Dim Dock2 As Dock

        Public ReadOnly Property Dock
            Get
                Return Dock2
            End Get
        End Property

        Public Sub New(ByVal Height As Integer, ByVal Dock As Dock)
            Size = Height
            Dock2 = Dock
        End Sub
    End Class
    Private Sub SliderSize_ValueChanged(ByVal sender As System.Object, ByVal e As System.Windows.RoutedPropertyChangedEventArgs(Of System.Double)) Handles SliderSize.ValueChanged
        Try
            Label3.Content = SliderSize.Value & " Pixel"
        Catch ex As Exception

        End Try
    End Sub
    Public Event PanelSaved(ByVal sender As System.Object, ByVal e As PanelSaveEventArgs)
    Private Sub ButtonOk_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ButtonOk.Click
        My.Settings.PanelDock = ComboBoxDock.SelectedIndex
        My.Settings.PanelSize = SliderSize.Value

        Dim Dock As Dock = ComboBoxDock.SelectedIndex

        Dim PanelArgs As New PanelSaveEventArgs(SliderSize.Value, Dock)
        RaiseEvent PanelSaved(Me, PanelArgs)
        Me.Close()
    End Sub

    Private Sub ButtonCancel_Click(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles ButtonCancel.Click
        Me.Close()
    End Sub

    Private Sub Window_Loaded(ByVal sender As System.Object, ByVal e As System.Windows.RoutedEventArgs) Handles MyBase.Loaded
        Me.Background = New SolidColorBrush(SystemColors.ControlColor)
        ComboBoxDock.SelectedIndex = My.Settings.PanelDock
        SliderSize.Value = My.Settings.PanelSize
    End Sub
End Class
